<?php

/**
 * Contract filter form base class.
 *
 * @package    seth
 * @subpackage filter
 * @author     Fuz
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseContractFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plant'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plant'), 'add_empty' => true)),
      'owner'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Client'), 'add_empty' => true)),
      'type'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'start'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'end'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duration'         => new sfWidgetFormFilterInput(),
      'fee'              => new sfWidgetFormFilterInput(),
      'istat'            => new sfWidgetFormFilterInput(),
      'bonus'            => new sfWidgetFormFilterInput(),
      'penals'           => new sfWidgetFormFilterInput(),
      're'               => new sfWidgetFormFilterInput(),
      'an'               => new sfWidgetFormFilterInput(),
      'pr'               => new sfWidgetFormFilterInput(),
      'moduleyeardecay'  => new sfWidgetFormFilterInput(),
      'pr_num'           => new sfWidgetFormFilterInput(),
      'an_num'           => new sfWidgetFormFilterInput(),
      'pac'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'fac'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'guarprod_kwh'     => new sfWidgetFormFilterInput(),
      'guargeneral'      => new sfWidgetFormFilterInput(),
      'guarinv'          => new sfWidgetFormFilterInput(),
      'guartrasf'        => new sfWidgetFormFilterInput(),
      'guarmvswitch'     => new sfWidgetFormFilterInput(),
      'guarpowercenter'  => new sfWidgetFormFilterInput(),
      'guarcables'       => new sfWidgetFormFilterInput(),
      'guarstructure'    => new sfWidgetFormFilterInput(),
      'guaraircond'      => new sfWidgetFormFilterInput(),
      'guarmodules'      => new sfWidgetFormFilterInput(),
      'guarsecurity'     => new sfWidgetFormFilterInput(),
      'costextramaint'   => new sfWidgetFormFilterInput(),
      'costspareparts'   => new sfWidgetFormFilterInput(),
      'cleaningsperyear' => new sfWidgetFormFilterInput(),
      'grasscutyear'     => new sfWidgetFormFilterInput(),
      'prevmaintyear'    => new sfWidgetFormFilterInput(),
      'roadmaint'        => new sfWidgetFormFilterInput(),
      'guardians'        => new sfWidgetFormFilterInput(),
      'fidejussioni'     => new sfWidgetFormFilterInput(),
      'credits'          => new sfWidgetFormFilterInput(),
      'safetydocs'       => new sfWidgetFormFilterInput(),
      'note1'            => new sfWidgetFormFilterInput(),
      'note2'            => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'plant'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Plant'), 'column' => 'id')),
      'owner'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Client'), 'column' => 'id')),
      'type'             => new sfValidatorPass(array('required' => false)),
      'start'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'end'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'duration'         => new sfValidatorPass(array('required' => false)),
      'fee'              => new sfValidatorPass(array('required' => false)),
      'istat'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'bonus'            => new sfValidatorPass(array('required' => false)),
      'penals'           => new sfValidatorPass(array('required' => false)),
      're'               => new sfValidatorPass(array('required' => false)),
      'an'               => new sfValidatorPass(array('required' => false)),
      'pr'               => new sfValidatorPass(array('required' => false)),
      'moduleyeardecay'  => new sfValidatorPass(array('required' => false)),
      'pr_num'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'an_num'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'pac'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fac'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'guarprod_kwh'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'guargeneral'      => new sfValidatorPass(array('required' => false)),
      'guarinv'          => new sfValidatorPass(array('required' => false)),
      'guartrasf'        => new sfValidatorPass(array('required' => false)),
      'guarmvswitch'     => new sfValidatorPass(array('required' => false)),
      'guarpowercenter'  => new sfValidatorPass(array('required' => false)),
      'guarcables'       => new sfValidatorPass(array('required' => false)),
      'guarstructure'    => new sfValidatorPass(array('required' => false)),
      'guaraircond'      => new sfValidatorPass(array('required' => false)),
      'guarmodules'      => new sfValidatorPass(array('required' => false)),
      'guarsecurity'     => new sfValidatorPass(array('required' => false)),
      'costextramaint'   => new sfValidatorPass(array('required' => false)),
      'costspareparts'   => new sfValidatorPass(array('required' => false)),
      'cleaningsperyear' => new sfValidatorPass(array('required' => false)),
      'grasscutyear'     => new sfValidatorPass(array('required' => false)),
      'prevmaintyear'    => new sfValidatorPass(array('required' => false)),
      'roadmaint'        => new sfValidatorPass(array('required' => false)),
      'guardians'        => new sfValidatorPass(array('required' => false)),
      'fidejussioni'     => new sfValidatorPass(array('required' => false)),
      'credits'          => new sfValidatorPass(array('required' => false)),
      'safetydocs'       => new sfValidatorPass(array('required' => false)),
      'note1'            => new sfValidatorPass(array('required' => false)),
      'note2'            => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('contract_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contract';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'plant'            => 'ForeignKey',
      'owner'            => 'ForeignKey',
      'type'             => 'Text',
      'start'            => 'Date',
      'end'              => 'Date',
      'duration'         => 'Text',
      'fee'              => 'Text',
      'istat'            => 'Number',
      'bonus'            => 'Text',
      'penals'           => 'Text',
      're'               => 'Text',
      'an'               => 'Text',
      'pr'               => 'Text',
      'moduleyeardecay'  => 'Text',
      'pr_num'           => 'Number',
      'an_num'           => 'Number',
      'pac'              => 'Date',
      'fac'              => 'Date',
      'guarprod_kwh'     => 'Number',
      'guargeneral'      => 'Text',
      'guarinv'          => 'Text',
      'guartrasf'        => 'Text',
      'guarmvswitch'     => 'Text',
      'guarpowercenter'  => 'Text',
      'guarcables'       => 'Text',
      'guarstructure'    => 'Text',
      'guaraircond'      => 'Text',
      'guarmodules'      => 'Text',
      'guarsecurity'     => 'Text',
      'costextramaint'   => 'Text',
      'costspareparts'   => 'Text',
      'cleaningsperyear' => 'Text',
      'grasscutyear'     => 'Text',
      'prevmaintyear'    => 'Text',
      'roadmaint'        => 'Text',
      'guardians'        => 'Text',
      'fidejussioni'     => 'Text',
      'credits'          => 'Text',
      'safetydocs'       => 'Text',
      'note1'            => 'Text',
      'note2'            => 'Text',
    );
  }
}
